package map;

import java.util.HashMap;
import java.util.Map;

/**
 * Map常用方法: get()根据键获取值、size()获取集合大小、isEmpty()判断空集
 *             containsKey()包含key、containsValue()包含value
 *             remove()根据键删除键值对、clear()清空集合
 */
public class mapDemo02 {
    public static void main(String[] args) {
        Map<String,Integer> map = new HashMap();
        map.put("java",89);
        map.put("c++",98);
        map.put("python",97);
        System.out.println(map);
        Integer value = map.get("java");
        System.out.println(value);
        int num = map.size();
        System.out.println("map.size() = " +num);
        System.out.println("map.isEmpty() "+map.isEmpty());
        System.out.println("map.containsKey('java') "+map.containsKey("java"));
        System.out.println(map.containsKey("web"));
        System.out.println("map.containValue()"+map.containsValue(69));
         value = map.remove("c++");
        System.out.println("map.remove()"+value);
        System.out.println(map);
        map.clear();
        System.out.println(map);
    }
}
